package util;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class Utils {

	public static String dateToString(Calendar date, String separator) {
		String res = "";
		res += (date.get(Calendar.DAY_OF_MONTH) < 10) ? "0" + date.get(Calendar.DAY_OF_MONTH) : date.get(Calendar.DAY_OF_MONTH);
		int month = date.get(Calendar.MONTH)+1;
		res += separator;
		res += (month < 10) ? "0" + month : month;
		res += separator;
		res += date.get(Calendar.YEAR);
		return res;
	}
	
	public static String dateToString(Calendar date) {
		return dateToString(date, "/");
	}
	
	public static String newDateToString(String separator) {
		return dateToString(new GregorianCalendar(), separator);
	}
	
	public static String newDateToString() {
		return newDateToString("/");
	}
	
	public static String currentMonth() {
		String res = "";
		Calendar date = new GregorianCalendar();
		int month = date.get(Calendar.MONTH)+1;
		res += (month < 10) ? "0" + month : month;
		res += "/";
		res += date.get(Calendar.YEAR);
		return res;
	}
	
}
